import numpy as np

B = np.arange(3)
# square root
print(B)
print(np.sqrt(B))

# return the floor of the input
a = np.floor(10 * np.random.random((3, 4)))
print(a)
# Return a flattened array.
print(a.ravel())

a.shape = (6, 2)
print(a)
# matrix transpose
print(a.T)

print('---')
# reshape
a.resize((2, 6))
print(a)

a = np.floor(10 * np.random.random((2, 2)))
b = np.floor(10 * np.random.random((2, 2)))
print('---')
print(a)
print('---')
print(b)
print('---')
# Stack arrays in sequence horizontally (column wise)
print(np.hstack((a, b)))
# Stack arrays in sequence vertically (row wise).
print(np.vstack((a, b)))

a = np.floor(10 * np.random.random((2, 12)))
print('---')
print(a)
print('---')
# Split an array into multiple sub-arrays horizontally (column-wise).
print(np.hsplit(a, 3))
print('---')
print(np.hsplit(a, np.array([1, 3])))
print('---')
print(np.vsplit(a, 2))
print('---')

a = np.arange(12)
b = a
b.shape = (3, 4)
print(b is a)
print(a)

# New view of array with the same data.
c = a.view()
print(c is a)
c.shape = (2, 6)
c[0, 0] = 9999
print(c)
print(a)

# Return a copy of the array.
d = a.copy()
print('---')
d[0, 1] = 888888
print(d)
print(a)

